/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package backendpkg;

import com.mysql.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Get Connection to mydb database
 * @author smag
 */
public class DataSource {
        private String dbURI = "jdbc:mysql://localhost/mydb";
        private String userName = "root";
        private String password = "admin";

        public Connection getConnection() {
            Connection connection = null;

            try {
                Class.forName("com.mysql.jdbc.Driver");
                connection = (Connection) DriverManager.getConnection(dbURI,userName, password);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch(SQLException e) {
                e.printStackTrace();
            }
            return connection;
        }
}
